package com.sunseen.capacitormachine.data;

public final class Constant {

    /**
     * 烤箱内默认初始化327条空夹具(对应夹具链路表0到326)
     */
    public static final int HolderInitSize = 327;

    /**
     * 初始化状态，进出料链条上有7条夹具(烤箱内的第三层出料那根也计做链条上的)，
     * 所以共有8条夹具
     */
    public static final int ChainHolderInitSize = 8;

    /**
     * 烤箱内测量链路与夹具队列号的对应表
     * 第三层出料口为夹具队列头部
     * 第一层进料口为夹具队列尾部
     */
    public static short[][] HolderPosTable = {
            {
                    324, 323, 322, -1, 321, 320, 319, 318, 101, 102,
                    103, 104, 317, 105, 99, 316, 106, 98, 315, 107,
                    97, 314, 108, 96, 313, 109, 95, 312, 110, 94,
                    311, 111, 93, 310, 112, 92, 309, 113, 91, 308,
                    114, 90, 307, 115, 89, 306, 116, 88, 305, 117,
                    87, 304, 118, 86, 303, 119, 85, 302, 120, 84,
                    301, 121, 83, 300, 122, 82, 299, 123, 81, 298,
                    124, 80, 297, 125, 79, 296, 126, 78, 295, 127,
                    77, 294, 128, 76, 293, 129, 75, 292, 130, 74,
                    291, 131, 73, 290, 132, 72, 289, 133, 71, 288,
                    134, 70, 287, 135, 69, 286, 136, 68, 285, 137,
                    67, 284, 138, 66, 283, 139, 65, 282, 140, 64,
                    281, 141, 63, 280, 142, 62, 279, 143, 61, 278,
                    144, 60, 277, 145, 59, 276, 146, 58, 275, 147,
                    57, 274, 148, 56, 273, 149, 55, 272, 150, 54,
                    271, 151, 53, 270, 152, 52, 269, 153, 51,
            },

            {
                    1, 2, -1, 203, 202, 0, 214, 205, 204, 217,
                    216, 215, 220, 219, 218, 221, 201, 3, 222, 200,
                    4, 223, 199, 5, 224, 198, 6, 225, 197, 7,
                    226, 196, 8, 227, 195, 9, 228, 194, 10, 229,
                    193, 11, 230, 192, 12, 231, 191, 13, 232, 190,
                    14, 233, 189, 15, 234, 188, 16, 235, 187, 17,
                    236, 186, 18, 237, 185, 19, 238, 184, 20, 239,
                    183, 21, 240, 182, 22, 241, 181, 23, 242, 180,
                    24, 243, 179, 25, 244, 178, 26, 245, 177, 27,
                    246, 176, 28, 247, 175, 29, 248, 174, 30, 249,
                    173, 31, 250, 172, 32, 251, 171, 33, 252, 170,
                    34, 253, 169, 35, 254, 168, 36, 255, 167, 37,
                    256, 166, 38, 257, 165, 39, 258, 164, 40, 259,
                    163, 41, 260, 162, 42, 261, 161, 43, 262, 160,
                    44, 263, 159, 45, 264, 158, 46, 265, 157, 47,
                    266, 156, 48, 267, 155, 49, 268, 154, 50,
            }
    };


//    private static int test(short[] s){
//        for(int i = 0; i < s.length - 1; i++)
//        {
//            for (int j = i + 1; j < s.length; j ++){
//                if(s[i] == s[j])
//                {
//                    return s[i];
//                }
//            }
//        }
//        return -3;
//    }
//
//    public static void main(String[] args) {
//        System.out.println(test(HolderPosTable[0]));
//        System.out.println(test(HolderPosTable[1]));
//        System.out.println(test(HardwarePosTable[0]));
//        System.out.println(test(HardwarePosTable[1]));
//    }


    /**
     * 烤箱内红外采集模块板子的对应数字标记
     */
    public static short[][] HardwarePosTable = new short[][]{
            {
                    3, 4, 5, -1, 6, 7, 8, 9, 226, 225,
                    224, 223, 10, 222, 228, 11, 221, 229, 12, 220,
                    230, 13, 219, 231, 14, 218, 232, 15, 217, 233,
                    16, 216, 234, 17, 215, 235, 18, 214, 236, 19,
                    213, 237, 20, 212, 238, 21, 211, 239, 22, 210,
                    240, 23, 209, 241, 24, 208, 242, 25, 207, 243,
                    26, 206, 244, 27, 205, 245, 28, 204, 246, 29,
                    203, 247, 30, 202, 248, 31, 201, 249, 32, 200,
                    250, 33, 199, 251, 34, 198, 252, 35, 197, 253,
                    36, 196, 254, 37, 195, 255, 38, 194, 256, 39,
                    193, 257, 40, 192, 258, 41, 191, 259, 42, 190,
                    260, 43, 189, 261, 44, 188, 262, 45, 187, 263,
                    46, 186, 264, 47, 185, 265, 48, 184, 266, 49,
                    183, 267, 50, 182, 268, 51, 181, 269, 52, 180,
                    270, 53, 179, 271, 54, 178, 272, 55, 177, 273,
                    56, 176, 274, 57, 175, 275, 58, 174, 276,
            },
            {
                    326, 325, -1, 124, 125, 327, 113, 122, 123, 110,
                    111, 112, 107, 108, 109, 106, 126, 324, 105, 127,
                    323, 104, 128, 322, 103, 129, 321, 102, 130, 320,
                    101, 131, 319, 100, 132, 318, 99, 133, 317, 98,
                    134, 316, 97, 135, 315, 96, 136, 314, 95, 137,
                    313, 94, 138, 312, 93, 139, 311, 92, 140, 310,
                    91, 141, 309, 90, 142, 308, 89, 143, 307, 88,
                    144, 306, 87, 145, 305, 86, 146, 304, 85, 147,
                    303, 84, 148, 302, 83, 149, 301, 82, 150, 300,
                    81, 151, 299, 80, 152, 298, 79, 153, 297, 78,
                    154, 296, 77, 155, 295, 76, 156, 294, 75, 157,
                    293, 74, 158, 292, 73, 159, 291, 72, 160, 290,
                    71, 161, 289, 70, 162, 288, 69, 163, 287, 68,
                    164, 286, 67, 165, 285, 66, 166, 284, 65, 167,
                    283, 64, 168, 282, 63, 169, 281, 62, 170, 280,
                    61, 171, 279, 60, 172, 278, 59, 173, 277,
            }};

    /**
     * 烤箱内各个电源上的夹具对应的夹具队列的起始与结束编号
     */
    public static final char[][] POWER_SUPPLY_ID_GAP_TABLE = {
            {326, 315}, {314, 303}, {302, 291}, {290, 279}, {278, 267}, {266, 253}, {252, 239}, {238, 225}, {224, 209},
            {209, 190}, {189, 168}, {167, 146}, {145, 124}, {123, 100},
            {100, 77}, {76, 53}, {52, 29}, {28, 6}, {5, 0}
    };

    public static final int[] BitMask0 = new int[]{
            0b10000000, 0b01000000, 0b00100000, 0b00010000,
            0b00001000, 0b00000100, 0b00000010, 0b00000001,
    };
}
